matcher->path.klass = child->path.klass;
matcher->path.path = child->path.path;
- matcher->path.state_flags = 0;
matcher->path.index = child->path.index - 1;
matcher->path.sibling_index = gtk_widget_path_iter_get_sibling_index (matcher->path.path, matcher->path.index);
matcher->path.klass = next->path.klass;
matcher->path.path = next->path.path;
- matcher->path.state_flags = 0;
matcher->path.index = next->path.index;
matcher->path.sibling_index = next->path.sibling_index - 1;
static GtkStateFlags
gtk_css_matcher_widget_path_get_state (const GtkCssMatcher *matcher)
{
- return matcher->path.state_flags;
+ return gtk_widget_path_iter_get_state (matcher->path.path, matcher->path.index);
}
static gboolean
gboolean
_gtk_css_matcher_init (GtkCssMatcher *matcher,
- const GtkWidgetPath *path,
- GtkStateFlags state)
+ const GtkWidgetPath *path)
{
if (gtk_widget_path_length (path) == 0)
return FALSE;
matcher->path.klass = >K_CSS_MATCHER_WIDGET_PATH;
matcher->path.path = path;
- matcher->path.state_flags = state;
matcher->path.index = gtk_widget_path_length (path) - 1;
matcher->path.sibling_index = gtk_widget_path_iter_get_sibling_index (path, matcher->path.index);
struct _GtkCssMatcherWidgetPath {
const GtkCssMatcherClass *klass;
const GtkWidgetPath *path;
- GtkStateFlags state_flags;
guint index;
guint sibling_index;
};
};
gboolean _gtk_css_matcher_init (GtkCssMatcher *matcher,
- const GtkWidgetPath *path,
- GtkStateFlags state) G_GNUC_WARN_UNUSED_RESULT;
+ const GtkWidgetPath *path) G_GNUC_WARN_UNUSED_RESULT;
void _gtk_css_matcher_any_init (GtkCssMatcher *matcher);
void _gtk_css_matcher_superset_init (GtkCssMatcher *matcher,
const GtkCssMatcher *subset,
#include "gtkstylepropertiesprivate.h"
#include "gtkstylepropertyprivate.h"
#include "gtkstyleproviderprivate.h"
+#include "gtkwidgetpath.h"
#include "gtkbindings.h"
#include "gtkmarshalers.h"
#include "gtkprivate.h"
gchar *prop_name;
gint i;
- if (!_gtk_css_matcher_init (&matcher, path, state))
- return FALSE;
+ if (state == gtk_widget_path_iter_get_state (path, -1))
+ {
+ gtk_widget_path_ref (path);
+ }
+ else
+ {
+ path = gtk_widget_path_copy (path);
+ gtk_widget_path_iter_set_state (path, -1, state);
+ }
+
+ if (!_gtk_css_matcher_init (&matcher, path))
+ {
+ gtk_widget_path_unref (path);
+ return FALSE;
+ }
tree_rules = _gtk_css_selector_tree_match_all (priv->tree, &matcher);
verify_tree_match_results (css_provider, &matcher, tree_rules);
g_free (prop_name);
g_ptr_array_free (tree_rules, TRUE);
+ gtk_widget_path_unref (path);
return found;
}
}
/* Set widget state */
- gtk_widget_path_iter_set_state (path, pos,
- gtk_widget_path_iter_get_state (path, pos) | info->state_flags);
+ gtk_widget_path_iter_set_state (path, pos, info->state_flags);
return path;
}
path = create_query_path (context, info);
lookup = _gtk_css_lookup_new (relevant_changes);
- if (_gtk_css_matcher_init (&matcher, path, info->state_flags))
+ if (_gtk_css_matcher_init (&matcher, path))
_gtk_style_provider_private_lookup (GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
&matcher,
lookup);
GtkCssMatcher matcher, superset;
path = create_query_path (context, priv->info);
- if (_gtk_css_matcher_init (&matcher, path, priv->info->state_flags))
+ if (_gtk_css_matcher_init (&matcher, path))
{
_gtk_css_matcher_superset_init (&superset, &matcher, GTK_STYLE_CONTEXT_RADICAL_CHANGE & ~GTK_CSS_CHANGE_SOURCE);
priv->relevant_changes = _gtk_style_provider_private_get_change (GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),